package com.mes.inventory.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;
import com.mes.basicdata.domain.Employee;
import com.mes.common.domain.BasicModel;

/**
 * <p>
 * InvCheckdetail实体，代表库存盘点明细。
 * </p>
 * 
 */
@Entity()
@Table(name = "I_CHECKDETAIL")
@BatchSize(size=20)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class InvCheckDetail extends BasicModel{
	//唯一号
	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name="UNIQUEID")
	protected String uniqueId;
	
	// 盘点单号
	@Column(name="INVCHECKID")
	protected String invCheckUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="INVCHECKID",insertable=false,updatable=false)
	protected InvCheck invCheck;
	
	// 行号
	@Column(name="SEQ")
	protected Integer seq;
	
	// 物料唯一号
	@Column(name="MATERIALUSN")
	protected String materialUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="MATERIALUSN",insertable=false,updatable=false)
	protected Material material;
	
	// 库房编号
	@Column(name="WAREHOUSEID")
	protected String warehouseUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="WAREHOUSEID",insertable=false,updatable=false)
	protected Warehouse warehouse;
	
	// 柜位编号
	@Column(name="BINID")
	protected String warebinUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="BINID",insertable=false,updatable=false)
	protected Warebin warebin;
	
	// 单位
	@Column(name="UOM")
	protected String uom;
	
	// 单价
	@Column(name="UNITPRICE")
	protected Float unitPrice;
	
	// 在库数量
	@Column(name="ACCOUNTEDQTY")
	protected Float accountedQty;
	
	// 统计金额
	@Column(name="ACCOUNTEDAMOUNT")
	protected Float accountedAmount;
	
	// 实际数量
	@Column(name="ACTUALQTY")
	protected Float actualQty;
	
	// 实际金额
	@Column(name="ACTUALAMOUNT")
	protected Float actualAmount;
		
	// 差异数量
	@Column(name="VARIANCEQTY")
	protected Float varianceQty;
	
	// 差异金额
	@Column(name="VARIANCEAMOUNT")
	protected Float varianceAmount;
	
	// 调整数量
	@Column(name="ADJUSTQTY")
	protected Float adjustQty;
		
	// 调整金额
	@Column(name="ADJUSTAMOUNT")
	protected Float adjustAmount;
		
	// 调整人的id
	@Column(name="ADJUSTEMP")
	protected String adjustEmployeeUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ADJUSTEMP",insertable=false,updatable=false)
	protected Employee adjustEmployee;
	
	// 盘点差异原因
	@Column(name="CHECK_VARIANCE_REASON")
	protected String reason;
	
	// 盘点容差
	@Column(name="CHECK_TOLERANCE")
	protected float tolerange;
	
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getUniqueId();
	}

	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setUniqueId(uuid);
	}

	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	public String getInvCheckUid() {
		return invCheckUid;
	}

	public void setInvCheckUid(String invCheckUid) {
		this.invCheckUid = invCheckUid;
	}

	public InvCheck getInvCheck() {
		return invCheck;
	}

	public void setInvCheck(InvCheck invCheck) {
		this.invCheck = invCheck;
	}

	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

	public String getMaterialUid() {
		return materialUid;
	}

	public void setMaterialUid(String materialUid) {
		this.materialUid = materialUid;
	}

	public Material getMaterial() {
		return material;
	}

	public void setMaterial(Material material) {
		this.material = material;
	}

	public String getWarehouseUid() {
		return warehouseUid;
	}

	public void setWarehouseUid(String warehouseUid) {
		this.warehouseUid = warehouseUid;
	}

	public Warehouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}

	public String getWarebinUid() {
		return warebinUid;
	}

	public void setWarebinUid(String warebinUid) {
		this.warebinUid = warebinUid;
	}

	public Warebin getWarebin() {
		return warebin;
	}

	public void setWarebin(Warebin warebin) {
		this.warebin = warebin;
	}

	public String getUom() {
		return uom;
	}

	public void setUom(String uom) {
		this.uom = uom;
	}

	public Float getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(Float unitPrice) {
		this.unitPrice = unitPrice;
	}

	public Float getAccountedQty() {
		return accountedQty;
	}

	public void setAccountedQty(Float accountedQty) {
		this.accountedQty = accountedQty;
	}

	public Float getAccountedAmount() {
		return accountedAmount;
	}

	public void setAccountedAmount(Float accountedAmount) {
		this.accountedAmount = accountedAmount;
	}

	public Float getActualQty() {
		return actualQty;
	}

	public void setActualQty(Float actualQty) {
		this.actualQty = actualQty;
	}

	public Float getActualAmount() {
		return actualAmount;
	}

	public void setActualAmount(Float actualAmount) {
		this.actualAmount = actualAmount;
	}

	public Float getVarianceQty() {
		return varianceQty;
	}

	public void setVarianceQty(Float varianceQty) {
		this.varianceQty = varianceQty;
	}

	public Float getVarianceAmount() {
		return varianceAmount;
	}

	public void setVarianceAmount(Float varianceAmount) {
		this.varianceAmount = varianceAmount;
	}

	public Float getAdjustQty() {
		return adjustQty;
	}

	public void setAdjustQty(Float adjustQty) {
		this.adjustQty = adjustQty;
	}

	public Float getAdjustAmount() {
		return adjustAmount;
	}

	public void setAdjustAmount(Float adjustAmount) {
		this.adjustAmount = adjustAmount;
	}

	public String getAdjustEmployeeUid() {
		return adjustEmployeeUid;
	}

	public void setAdjustEmployeeUid(String adjustEmployeeUid) {
		this.adjustEmployeeUid = adjustEmployeeUid;
	}

	public Employee getAdjustEmployee() {
		return adjustEmployee;
	}

	public void setAdjustEmployee(Employee adjustEmployee) {
		this.adjustEmployee = adjustEmployee;
	}

	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public float getTolerange() {
		return tolerange;
	}

	public void setTolerange(float tolerange) {
		this.tolerange = tolerange;
	}
	
	
}